#pragma once

#include "ExcepBase.h"

namespace tinytool
{
namespace line
{

#define THROW_EXCEP_LINE_IF(expr, msg)                  \
    do {                                                \
        if ((expr)) {                                   \
            std::ostringstream oss;                     \
            oss << HTF_ERROR_WHERE << msg;              \
            throw tinytool::line::ExcepLine{oss.str()}; \
        }                                               \
    } while (0)

class ExcepLine : public ExcepBase
{
public:
    ExcepLine(const std::string& what)
        : ExcepBase{"line-error: " + what} {}
    ~ExcepLine() = default;
};

}   // namespace line
}   // namespace tinytool